"""
核心模块
提供配置、数据库、日志等核心功能
"""

from .config import settings, Settings
from .database import get_db, get_db_session, db_manager, create_tables
from .logging_config import get_logger, log_performance, log_db_operation, log_api_request
from .auth import (
    create_access_token, verify_token, get_current_user, get_current_active_user,
    require_permissions, require_role, require_admin, require_superuser,
    PermissionChecker, init_auth_data
)
from .exceptions import (
    PetitionSystemException,
    AuthenticationError,
    AuthorizationError,
    ValidationError,
    DatabaseError,
    DataNotFoundError,
    DataAlreadyExistsError,
    FileUploadError,
    AIServiceError,
    TaskExecutionError,
    ConfigurationError,
    ExternalServiceError,
    setup_exception_handlers,
    handle_exceptions,
    handle_db_errors,
    handle_ai_service_errors
)

__all__ = [
    # 配置
    "settings",
    "Settings",
    
    # 数据库
    "get_db",
    "get_db_session", 
    "db_manager",
    "create_tables",
    
    # 日志
    "get_logger",
    "log_performance",
    "log_db_operation",
    "log_api_request",
    
    # 认证
    "create_access_token",
    "verify_token",
    "get_current_user",
    "get_current_active_user",
    "require_permissions",
    "require_role",
    "require_admin",
    "require_superuser",
    "PermissionChecker",
    "init_auth_data",
    "admin_dependency",
    "user_manage_dependency",
    "data_source_manage_dependency",
    "analysis_task_manage_dependency",
    "report_manage_dependency",
    "system_config_dependency",
    "admin_role_dependency",
    "manager_role_dependency",
    "analyst_role_dependency",
    
    # 异常
    "PetitionSystemException",
    "AuthenticationError",
    "AuthorizationError",
    "ValidationError",
    "DatabaseError",
    "DataNotFoundError",
    "DataAlreadyExistsError",
    "FileUploadError",
    "AIServiceError",
    "TaskExecutionError",
    "ConfigurationError",
    "ExternalServiceError",
    "setup_exception_handlers",
    "handle_exceptions",
    "handle_db_errors",
    "handle_ai_service_errors"
]